import React from "react";
import { useSelector, useDispatch } from "react-redux";
import {
  increment,
  incrementByAmount,
  incrementAsync,
} from "./store/counter/index";

const App = () => {
  const value = useSelector((state) => {
    return state.counter.value;
  });
  const dispatch = useDispatch();
  return (
    <>
      <h2>rkt</h2>
      <span>value: {value}</span>
      <button onClick={() => dispatch(increment())}>+1</button>
      <button onClick={() => dispatch(incrementByAmount(3))}>+3</button>
      <button onClick={() => dispatch(incrementAsync(3))}>异步+3</button>
    </>
  );
};

export default App;
